import Vue from "vue"
import Router from "vue-router"
import Login from "./views/login.vue"
import Admin from "./views/admin.vue"
import Welcome from "./views/admin/welcome.vue"
import Administrator from "./views/admin/bbsAdministrator.vue"
import Member from './views/admin/bbsMember'
import Book from './views/admin/bbsBook'
import BookLink from './views/admin/bbsLinkMemberBook'
import UserMember from './views/user/member'
import Borrow from './views/user/borrow'
import Record from './views/user/record'

Vue.use(Router)

export default new Router({
    mode: "history",
    base: process.env.BASE_URL,
    routes: [{
        path: "*",
        redirect: "/login",
    },{
        path: "/",
        component: Login
    },{
        path: "/login",
        component: Login
    },{
        path: "/",
        name: "admin",
        component: Admin,
        meta:{
          loginRequire:true
        },
        children: [{
            path: "welcome",
            name: "welcome",
            component: Welcome,
        }, { // 管理员信息管理
            path: "user/administrator",
            name: "user/administrator",
            component: Administrator,
        }, { // 会员信息管理
            path: "user/member",
            name: "user/member",
            component: Member,
        }, { // 图书信息管理
            path: "book/book",
            name: "book/book",
            component: Book,
        }, { // 图书借阅管理
            path: "book/book-link",
            name: "book/book-link",
            component: BookLink,
        }, { // 会员初始界面
            path: "member/member",
            name: "member/member",
            component: UserMember
        }, { // 借书界面
            path: "member/borrow",
            name: "member/borrow",
            component: Borrow
        }, { // 记录界面
            path: "member/record",
            name: "member/record",
            component: Record
        }]
    }]
})